<!--{template header}-->


<div class="d-flex align-items-center mt-4">
    <h4 class="mb-0">
        <!--{if !empty(#appName)}-->
        {#appName}
        <!--{else}-->
        {#plugin}
        <!--{/if}-->
        <span class="text-muted fs-1 fst-normal">{#branchName}</span>
    </h4>
    </div>
<ul class="nav nav-pills custom-pills mt-4" role="tablist">
    <!--{loop #settingConf $k $v}-->
    <li class="nav-item">
        <a class="nav-link{if $k == #page} active{/if}" href="{uri /system/page/setting}?plugin={#plugin}&ver={#ver}&page=$k"><span>{$v['name']}</span></a>
    </li>
    <!--{/loop}-->
    <span class="ms-auto d-flex align-items-center">
        <a href="{uri /system/page/index}" class="d-flex align-items-center" ><i class="ri-arrow-go-back-line me-1"></i>返回列表</a>
    </span>
</ul>
<form class="pt-5 border-top needs-validation" action="{uri /system/page/setting}?plugin={#plugin}&ver={#ver}&page={#page}" method="post" enctype="multipart/form-data">
    <!--{loop #settingConf[#page]['items'] $key $item}-->
    {eval $value = isset(#settingValue[$key]) ? #settingValue[$key] : $item['default'];}
    <div class="mb-3 row">
        <label for="example-search-input" class="col-md-2 col-form-label">{$item['name']}</label>
        <div class="col-md-10">
            <!--{if in_array($item['type'], array('text', 'number', 'datetime-local', 'date', 'time', 'month', 'color'))}-->
            <!-- 文本框 -->
            <input class="form-control" name="s[{$key}]" type="{$item['type']}" value="$value" {if $item['placeholder']} placeholder="{$item['placeholder']}"{/if}{if $item['required'] = 1} required{/if}>
            <!--{elseif $item['type'] == 'radio'}-->
            <!-- 单选框 -->
            <!--{loop $item['selects'] $v $n}-->
            <div class="form-check form-check-inline">
                <label><input class="form-check-input" name="s[{$key}]" type="radio" value="{$v}" {if $value== $v} checked{/if}>{$n}</label><br/>
            </div>
            <!--{/loop}-->
            <!--{elseif $item['type'] == 'checkbox'}-->
            <!-- 复选框 -->
            <!--{loop $item['selects'] $v $n}-->
            <div class="form-check form-check-inline">
                <label><input class="form-check-input" name="s[{$key}][]" type="checkbox" value="{$v}" {if in_array($v, is_array($value) ? $value : explode('|', $value))} checked{/if}>{$n}</label><br/>
            </div>
            <!--{/loop}-->
            <!--{elseif $item['type'] == 'select'}-->
            <!-- 单选下拉框 -->
            <select class="form-select" name="s[{$key}]">
                <!--{loop $item['selects'] $v $n}-->
                <option value="{$v}"<!--{if $value == $v}--> selected<!--{/if}--> >{$n}</option>
                <!--{/loop}-->
            </select>
            <!--{elseif $item['type'] == 'multipleSelect'}-->
            <!-- 多选下拉框 -->
            <select class="form-select" name="s[{$key}][]" multiple>
                <!--{loop $item['selects'] $v $n}-->
                <option value="{$v}" {if in_array($v, is_array($value) ? $value : explode(
                '|', $value))} selected{/if}>{$n}</option>
                <!--{/loop}-->
            </select>
            <!--{elseif $item['type'] == 'textarea'}-->
            <!-- 多行文本框 -->
            <textarea class="form-control" name="s[{$key}]" {if $item['placeholder']} placeholder="{$item['placeholder']}"{/if}>$value</textarea>
            <!--{elseif $item['type'] == 'image'}-->
            <!-- 上传图片 -->
            <input class="layui-upload-file" type="file" accept="" name="{$key}">
            <!--{if $value}-->
            <img src="{eval echo Lib\Cos::ImageUrl($value);}" style="width: 200px;height: auto;margin-top: 10px;"/>
            <!--{/if}-->
            <!--{/if}-->
            <div class="invalid-feedback">$item['desc']</div>
            <div style="font-size: 14px; padding-top: 10px;">$item['desc']</div>
        </div>
    </div>
    <!--{/loop}-->
    <div class="p-3 border-top">
        <div style="float: left" class="mt-2">
            设置为用户可修改的应用配置项，定义在 /conf/setting.yaml 中，并可用 Lib\GetSetting() 方法读取。<br /><a href="https://dev.witframe.com/wikis/SdkManual/%E5%BA%94%E7%94%A8%E9%85%8D%E7%BD%AE" target="_blank">查看手册</a>
        </div>
        <div class="form-group mb-0 text-end">
            <button type="submit" class="btn btn-info rounded-pill px-4 waves-effect waves-light"><i class="bi-check2-circle me-1"></i>提交</button>
        </div>
    </div>
</form>
<style>
    .invalid-feedback {
        position: relative;
        background-color: #ffffff;
        margin-bottom: -1.5rem;
    }
</style>

<!--{template footer}-->
